import React from "react"
import FooterNav from "../../components/shop_components/FooterNav"
import HomeHeadSearch from "../../components/home_components/HomeHeadSearch"
import Carousel from "../../components/home_components/Carousel"
import carousel1 from "../../static/images/home_img/carousel1.jpg"
import carousel2 from "../../static/images/home_img/carousel2.jpg"
import carousel3 from "../../static/images/home_img/carousel3.jpg"
import HomePlat from "../../components/home_components/HomePlat"
import HotHouse from "../../components/home_components/HotHouse"

import { withRouter } from "react-router-dom"
import { connect } from "react-redux"
// import * as webSession from "../../../WebSession"
// import * as key from "../../../WebSession/key"

class Home extends React.Component{
  constructor(){
    super();
    this.state = {
      localIcon: 'iconfont icon-weizhi',
      msgIcon: 'iconfont icon-xiaoxi',
      banners:[carousel1,carousel2,carousel3]
    }
  }
  render(){
    let { localIcon, msgIcon, banners} = this.state;
    
    return(
      <div className="hasFootNav">
        <HomeHeadSearch localIcon={localIcon} msgIcon={msgIcon} history={this.props.history}/>
        <Carousel banners={banners}/>
        <HomePlat />
        <HotHouse cityName={this.props.city.cityName}/>
        <FooterNav />
      </div>
    )
  }
}

// --------redux-------------

function mapStateToProps(state){
  return {
    city: state.cityinfo
  }
}

export default withRouter(connect(
  mapStateToProps,
)(Home))
